# 1.8 练习题：炸⾦花棋牌游戏
# 需求：
# 1. 允许⽤户⼀次性输⼊多个玩家姓名，不限个数，然后为每个玩家随机⽣成3张牌
# 2. 你只有⼀付扑克牌，确保发出去的每张牌不重样
# 3. 牌需要有⿊桃、红桃、⽅⽚、梅花之分

import random

def players() -> list:
    players_str = input('请输入多个玩家姓名（以空格分隔）：')
    return players_str.split()

def build() -> list:    # 生成一幅扑克
    base = ['A','2','3','4','5','6','7','8','9','10','J','Q','K']
    base_list = []
    for i in ['黑桃','红桃','梅花','方片']:
        for j in base:
            base_list.append(i+j)
    base_list.append('大鬼')
    base_list.append('小鬼')
    return base_list

def res(player, sol) -> dict:
    result = {}
    for i in player:
        temp = random.sample(sol, 3)
        result[i] = temp
        for j in range(3):
            sol.remove(temp[j])
    return result

if __name__ == '__main__':
    players = players()
    cards = build()
    result = res(players, cards)
    print(result)


